using MediatR;
using MeetingManagement.Domain.Entities;
using MeetingManagement.Domain.Repositories;

namespace MeetingManagement.Application.Queries.MeetingRooms
{
    public class GetAllMeetingRoomsQueryHandler : IRequestHandler<GetAllMeetingRoomsQuery, List<MeetingRoom>>
    {
        private readonly IRepository<MeetingRoom> _repository;
        public GetAllMeetingRoomsQueryHandler(IRepository<MeetingRoom> repository)
        {
            _repository = repository;
        }

        public Task<List<MeetingRoom>> Handle(GetAllMeetingRoomsQuery request, CancellationToken cancellationToken)
        {
            return Task.FromResult(_repository.Query().ToList());
        }
    }
}
